package demo03.Exception;
/*来看看父类异常和子类异常的情况*/
public class Fu {
    public void show01() throws NullPointerException,ClassCastException{}
    public void show02() throws IndexOutOfBoundsException{}
    public void show03() throws IndexOutOfBoundsException{}
    public void show04(){}
}
 class Zi extends Fu{
     //1.与父类丢一样的异常
     public void show01() throws NullPointerException,ClassCastException{}
     //2.丢一个异常的子类
     public void show02()throws ArrayIndexOutOfBoundsException{}
     //3.不丢，欸，就是不丢
     public void show03(){}
     //4.父类方法没有抛出异常，子类重写父类该方法时也不可抛出异常。
    // public void show04()throws Exception{}
     //只能捕获处理，不能声明抛出
     public void show04(){
         try {
             throw new Exception("编译期异常");
         }catch (Exception e){
             e.printStackTrace();
         }
     }
 }
